function createRequestObject()
{
    if (window.XMLHttpRequest) 
	{
        try 
		{
            return new XMLHttpRequest();
        } catch (e)
		{}
    
	} else if (window.ActiveXObject) 
	{
        try 
		{
            return new ActiveXObject('Msxml2.XMLHTTP');
        } catch (e){}
        try 
		{
            return new ActiveXObject('Microsoft.XMLHTTP');
            alert("Huy beo");
        } catch (e){}
    }
	
	return null;
	
}

var request = createRequestObject();

	if (request==null)
		alert('!!');

	function $(v)
	{
		return document.getElementById(v);
	}

	var state = false, cur_element = false;
	function showWait(element)
	{
		cur_element = element;

		if($(cur_element).style.display == 'none')
		{
			$(cur_element).style.display = 'block';
			$(cur_element+'_wait').style.display = 'none';
		}
		else
		{
			$(cur_element).style.display = 'none';
			$(cur_element+'_wait').style.display = 'block';
		}
	}
	
	function ScreenSize()
	{	
		var height=0;
		var width=0; 
		if (self.screen) 
		{
			width = screen.width
			height = screen.height
		}
		else if (self.java) 
		{
			var jkit = java.awt.Toolkit.getDefaultToolkit();
			var scrsize = jkit.getScreenSize();
			width = scrsize.width;
			height = scrsize.height;
		}else{
			width = height = 'x';
		}	
		//alert('width=' + width + '  height=' + height);
	}
//ScreenSize();

	function SetCookie(name, value) 
	{
		document.cookie = name + "=" + escape (value);
	}

		
	function isIE()
	{
		if (navigator.appName == 'Microsoft Internet Explorer')
		{
			request = null;
			request = createRequestObject();
			return true;
		}
		else
			return false;
	}
	
////////////////////
function ajax_function01(var01)
{
	var myvar01 = var01;
    var myvar01 = $('text box id 01').value;
	
		 
		
    var post = "postvar01=" + myvar01 + 
		"&postvar02=" + myvar01;
	isIE();
	//alert(post);
	request.onreadystatechange = request_ajax_function01; 
	request.open("POST", site_url+'ajax_request.php?type=ajax_action01', true);
	 
	request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	request.setRequestHeader('Accept-Charset', 'utf-8');
	request.send(post);
}

	function request_ajax_function01()
	{
	   
		if (request.readyState == 4 && request.status == 200)
		{
			 
			var ret = request.responseText;
			 //$('location_region').innerHTML = ret;
			//  alert(ret);
			 
 
			if(ret != '')
			{
				//TODO
			   // $('targetgroupsdropdown_'+myidsourcegroup).innerHTML = ret;
			    // $('category_fields').style.display = "block";
			}
			else
			 //TODO
 
			return false;
		}
	}
	
